package com.example.tys.daggermvp.dagger2;

import com.example.tys.daggermvp.mvp.view.Main2Activity;
import com.example.tys.daggermvp.mvp.view.MainActivity;
import com.example.tys.daggermvp.dagger2.annotation.ActivityScoped;
import com.example.tys.daggermvp.dagger2.module.MainActivity2Module;
import com.example.tys.daggermvp.dagger2.module.MainActivityModule;

import dagger.Module;
import dagger.android.ContributesAndroidInjector;

/**
 * Activity, Component, Module之间对应关系DaggerActivity中注入s
 * We want Dagger.Android to create a Subcomponent which has a parent Component of whichever mDataModule ActivityBindingModule is on,
 * in our case that will be AppComponent. The beautiful part about this setup is that you never need to tell AppComponent that it is going to have all these subcomponents
 * nor do you need to tell these subcomponents that AppComponent exists.
 * We are also telling Dagger.Android that this generated SubComponent needs to include the specified modules and be aware of a scope annotation @ActivityScoped
 * When Dagger.Android annotation processor runs it will create 4 subcomponents for us.
 *
 * @author tys
 */
@Module
public abstract class ActivityBindingModule {
    @ActivityScoped
    @ContributesAndroidInjector(modules = MainActivityModule.class)
    abstract MainActivity mainActivity();


    @ActivityScoped
    @ContributesAndroidInjector(modules = MainActivity2Module.class)
    abstract Main2Activity main2Activity();


}

